home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 36 / vfos_dv.zip / VIO_BIOS.INC < prev    next >
Text File  |  1988-08-01  |  15KB  |  524 lines

  1. ;
  2. ; VFOS_IBM VFOSSIL driver by Bob Hartman  (SysOp of 1:132/101).
  3. ; Copyright 1988 by Spark Software.  ALL RIGHTS RESERVED.
  4. ;
  5.  
  6. VioGetMode proc far
  7.  
  8.         Enter_Vio
  9.  
  10.         Check_Handle 00
  11.  
  12.         les     di,[bp+8]               ; get pointer to buffer
  13.         mov     cx,es:[di]              ; get length
  14.         push    cs                      ; set up ds
  15.         pop     ds
  16.         mov     si,offset mode_info     ; get pointer to mode buffer
  17.         cmp     cx,es:[di]              ; how does it stack up
  18.         jbe     f00_100                 ; it looks ok
  19.         mov     cx,es:[di]              ; get the other value
  20.  
  21. f00_100:
  22.         cmp     cx,3                    ; is it less than 3
  23.         jae     f00_101                 ; it is still good
  24.         mov     ax,382                  ; bad buffer size
  25.         jmp     f00_out                 ; get out
  26.  
  27. f00_101:
  28.         cld
  29.         repnz   movsb                   ; move the data
  30.  
  31.         mov     ax,0                    ; set up return code
  32.  
  33.         Exit_Vio 00,6                   ; get out
  34.  
  35. VioGetMode endp
  36.  
  37. VioSetMode proc far
  38.  
  39.         mov     ax,355
  40.         ret     6
  41.  
  42. VioSetMode endp
  43.  
  44. VioGetConfig proc far
  45.  
  46.         Enter_Vio
  47.  
  48.         Check_Handle 02
  49.  
  50.         les     di,[bp+8]               ; get pointer to buffer
  51.         mov     cx,es:[di]              ; get length
  52.         push    cs                      ; set up ds
  53.         pop     ds
  54.         mov     si,offset mode_info     ; get pointer to mode buffer
  55.         cmp     cx,es:[di]              ; how does it stack up
  56.         jbe     f02_100                 ; it looks ok
  57.         mov     cx,es:[di]              ; get the other value
  58.  
  59. f02_100:
  60.         cld
  61.         repnz   movsb                   ; move the data
  62.  
  63.         mov     ax,0                    ; set up return code
  64.  
  65.         Exit_Vio 02,6                   ; get out
  66.  
  67. VioGetConfig endp
  68.  
  69. VioWrtTTY proc far
  70.  
  71.         Enter_Vio
  72.  
  73.         Check_Handle 03
  74.  
  75.         push    cs
  76.         pop     ds
  77.         mov     ax,ansi_state           ; get current ANSI mode
  78.         mov     cx,[bp+8]               ; get string length
  79.         lds     dx,[bp+10]              ; get pointer to string
  80.        
  81.         or      ax,ax                   ; are we in ANSI mode?
  82.         jz      f03_100                 ; no ANSI, do it the other way
  83.  
  84.         mov     ah,40h                  ; set up for a write call
  85.         mov     bx,1                    ; use stdout
  86.         int     21h                     ; go do it
  87.  
  88.         jmp     f03_ok                  ; get out
  89.  
  90. f03_100:
  91.         mov     si,dx                   ; get the pointer to ds:si
  92.  
  93. f03_101:
  94.         lodsb                           ; get a byte
  95.         mov     ah,0eh                  ; write TTY mode
  96.         mov     bh,0                    ; page number
  97.         int     10h                     ; go do it through the BIOS
  98.         loop    f03_101                 ; do another one
  99.  
  100. f03_ok:
  101.         mov     ax,0                    ; say it was all ok
  102.  
  103.         Exit_Vio 03,8                   ; get out
  104.  
  105. VioWrtTTY endp
  106.  
  107. VioGetANSI proc far
  108.  
  109.         Enter_Vio
  110.  
  111.         Check_Handle 04
  112.  
  113.         push    cs
  114.         pop     ds
  115.         mov     ax,ansi_state           ; get current ansi state
  116.         les     di,[bp+8]               ; get pointer for where to put it
  117.         stosw                           ; mov it there
  118.  
  119.         mov     ax,0                    ; all is ok
  120.  
  121.         Exit_Vio 04,6                   ; get out
  122.  
  123. VioGetANSI endp
  124.  
  125. VioSetANSI proc far
  126.  
  127.         Enter_Vio
  128.  
  129.         Check_Handle 05
  130.  
  131.         lds     si,[bp+8]               ; get the pointer to the state
  132.         lodsw                           ; get the state
  133.         push    cs
  134.         pop     ds
  135.         mov     ansi_state,ax           ; save it away
  136.  
  137.         mov     ax,0                    ; all ok
  138.  
  139.         Exit_Vio 05,6                   ; get out
  140.  
  141. VioSetANSI endp
  142.  
  143. VioGetCurPos proc far
  144.  
  145.         Enter_Vio
  146.  
  147.         Check_Handle 06
  148.  
  149.         mov     ah,3                    ; get cursor position BIOS call
  150.         mov     bh,0
  151.         int     10h                     ; actually get it
  152.  
  153.         les     di,[bp+8]               ; get the pointer to the row
  154.         mov     dh,al                   ; save row in al
  155.         xor     ah,ah                   ; clear out ah
  156.         stosw                           ; store the row
  157.  
  158.         les     di,[bp+12]              ; get the pointer to the column
  159.         mov     dl,al                   ; get the column to al
  160.         stosw                           ; store the column
  161.  
  162.         mov     ax,0                    ; all ok
  163.  
  164.         Exit_Vio 06,10                  ; get out
  165.  
  166. VioGetCurPos endp
  167.  
  168. VioSetCurPos proc far
  169.  
  170.         Enter_Vio
  171.  
  172.         Check_Handle 07
  173.  
  174.         mov     ah,2                    ; BIOS call to set the cursor pos
  175.         mov     bh,0
  176.         mov     dh,byte ptr [bp+10]     ; get the row
  177.         cmp     dh,0                    ; check to see it is ok
  178.         jae     f07_100
  179.         mov     ax,358                  ; no good
  180.         jmp     f07_out
  181.  
  182. f07_100:
  183.         cmp     dh,24                   ; check it again
  184.         jbe     f07_101
  185.         mov     ax,358                  ; no good
  186.         jmp     f07_out
  187.  
  188. f07_101:
  189.         mov     dl,byte ptr [bp+8]      ; get the column
  190.         cmp     dl,0                    ; check if it is ok
  191.         jae     f07_102
  192.         mov     ax,359                  ; no good
  193.         jmp     f07_out
  194.  
  195. f07_102:
  196.         cmp     dl,79                   ; check it again
  197.         jbe     f07_103
  198.         mov     ax,359                  ; no good
  199.         jmp     f07_out
  200.  
  201. f07_103:
  202.         int     10h                     ; do the BIOS call
  203.  
  204.         mov     ax,0                    ; all ok
  205.  
  206.         Exit_Vio 07,6                   ; get out
  207.  
  208. VioSetCurPos endp
  209.  
  210. VioGetCurType proc far
  211.  
  212.         Enter_Vio
  213.  
  214.         Check_Handle 08
  215.  
  216.         les     di,[bp+8]               ; get pointer to buffer
  217.         push    cs                      ; set up ds
  218.         pop     ds
  219.         mov     si,offset curs_info     ; get pointer to cursor info
  220.         mov     cx,8                    ; length of cursor info
  221.  
  222.         cld
  223.         repnz   movsb                   ; move the data
  224.  
  225.         mov     ax,0                    ; set up return code
  226.  
  227.         Exit_Vio 08,6                   ; get out
  228.  
  229. VioGetCurType endp
  230.  
  231. VioSetCurType proc far
  232.  
  233.         Enter_Vio
  234.  
  235.         Check_Handle 09
  236.  
  237.         mov     ax,cs
  238.         mov     es,ax
  239.         mov     ds,ax
  240.         lds     si,[bp+8]               ; get pointer to buffer
  241.  
  242.         mov     ch,byte ptr ds:[si]     ; get column
  243.         mov     cl,byte ptr ds:[si+2]   ; get row
  244.         mov     ax,ds:[si+6]            ; get attribute
  245.         cmp     ax,-1                   ; is it off?
  246.         jne     f09_100                 ; no, so continue
  247.         mov     ch,30h                  ; turn off cursor
  248.         mov     ch,30h                  ; turn off cursor
  249.  
  250. f09_100:
  251.         mov     ah,1
  252.         mov     bh,0
  253.         int     10h                     ; use BIOS to set the position
  254.  
  255.         mov     di,offset curs_info     ; get pointer to cursor info
  256.         lds     si,[bp+8]               ; get pointer to buffer
  257.         mov     cx,8                    ; length of cursor info
  258.  
  259.         cld
  260.         repnz   movsb                   ; move the data
  261.  
  262.         mov     ax,0                    ; set up return code
  263.  
  264.         Exit_Vio 09,6                   ; get out
  265.  
  266. VioSetCurType endp
  267.  
  268. VioScrollUp proc far
  269.  
  270.         Enter_Vio
  271.  
  272.         Check_Handle 10
  273.  
  274.         Scroll_Stuff 10,6
  275.  
  276.         mov     ax,0
  277.  
  278.         Exit_Vio 10,16                  ; get out
  279.  
  280. VioScrollUp endp
  281.  
  282. VioScrollDn proc far
  283.  
  284.         Enter_Vio
  285.  
  286.         Check_Handle 11
  287.  
  288.         Scroll_Stuff 11,7
  289.  
  290.         mov     ax,0
  291.  
  292.         Exit_Vio 11,16                  ; get out
  293.  
  294. VioScrollDn endp
  295.  
  296. VioReadCellStr proc far
  297.  
  298.         Enter_Vio
  299.  
  300.         Check_Handle 12
  301.  
  302.         Do_Row_Col 12,10,8
  303.  
  304.         mov     ax,0b800h               ; offset for color card
  305.         mov     si,di                   ; get the address as source index
  306.         mov     ds,ax                   ; ds:si is now set up
  307.  
  308.         les     di,[bp+14]              ; get the pointer to count
  309.         mov     cx,es:[di];             ; put count in cx
  310.         les     di,[bp+18]              ; get the pointer in es:di
  311.  
  312.         cld
  313.         repnz   movsb                   ; move the bytes
  314.  
  315.         mov     ax,0                    ; successful return
  316.  
  317.         Exit_Vio 12,14                  ; get out
  318.  
  319. VioReadCellStr endp
  320.  
  321. VioReadCharStr proc far
  322.  
  323.         Enter_Vio
  324.  
  325.         Check_Handle 13
  326.  
  327.         Do_Row_Col 13,10,8
  328.  
  329.         mov     ax,0b800h               ; offset for color card
  330.         mov     si,di                   ; get the address as source index
  331.         mov     ds,ax                   ; ds:si is now set up
  332.  
  333.         les     di,[bp+14]              ; get length pointer
  334.         mov     cx,es:[di]              ; get length
  335.         les     di,[bp+18]              ; get the pointer in es:di
  336.  
  337. f13_100:
  338.         movsb                           ; move a byte
  339.         inc     di                      ; get past attribute
  340.         loop    f13_100                 ; do the next one
  341.  
  342.         mov     ax,0                    ; successful return
  343.  
  344.         Exit_Vio 13,14                  ; get out
  345.  
  346. VioReadCharStr endp
  347.  
  348. VioWrtCellStr proc far
  349.  
  350.         Enter_Vio
  351.  
  352.         Check_Handle 14
  353.  
  354.         Do_Row_Col 14,10,8
  355.  
  356.         mov     cx,[bp+12]              ; get length
  357.         shr     cx,1                    ; divide by two (two byte cells)
  358.         lds     si,[bp+14]              ; get the pointer in ds:si
  359.         mov     bh,0                    ; display page
  360.  
  361. f14_100:
  362.         Locate_Cursor 14
  363.  
  364.         lodsw                           ; get the cell into ax
  365.         mov     bl,ah                   ; put the attribute into bh
  366.         mov     ah,9                    ; call to write cell
  367.         push    cx                      ; save registers
  368.         push    si
  369.         mov     cx,1                    ; write it once
  370.         int     10h                     ; do the interrupt
  371.         pop     si                      ; restore registers
  372.         pop     cx
  373.         loop    f14_100                 ; loop and do it again
  374.  
  375.         mov     ax,0                    ; successful return
  376.  
  377.         Exit_Vio 14,12                  ; get out
  378.  
  379. VioWrtCellStr endp
  380.  
  381. VioWrtCharStr proc far
  382.  
  383.         Enter_Vio
  384.  
  385.         Check_Handle 15
  386.  
  387.         Do_Row_Col 15,10,8
  388.  
  389.         mov     cx,[bp+12]              ; get length
  390.         lds     si,[bp+14]              ; get the pointer in ds:si
  391.         mov     bh,0                    ; display page
  392.  
  393. f15_100:
  394.         Locate_Cursor 15
  395.  
  396.         lodsb                           ; get the char into al
  397.         mov     ah,10                   ; call to write char
  398.         push    cx                      ; save registers
  399.         push    si
  400.         mov     cx,1                    ; write it once
  401.         int     10h                     ; do the interrupt
  402.         pop     si                      ; restore registers
  403.         pop     cx
  404.         loop    f15_100                 ; loop and do it again
  405.  
  406.         mov     ax,0                    ; successful return
  407.  
  408.         Exit_Vio 15,12                  ; get out
  409.  
  410. VioWrtCharStr endp
  411.  
  412. VioWrtCharStrAtt proc far
  413.  
  414.         Enter_Vio
  415.  
  416.         Check_Handle 16
  417.  
  418.         Do_Row_Col 16,14,12
  419.  
  420.         mov     cx,[bp+16]              ; get length
  421.         lds     si,[bp+8]               ; get the pointer in ds:si
  422.         lodsb                           ; get the attribute
  423.         mov     bl,al                   ; save the attribute
  424.         lds     si,[bp+18]              ; get the pointer to chars
  425.         mov     bh,0                    ; display page
  426.  
  427.  
  428. f16_100:
  429.         Locate_Cursor 16
  430.  
  431.         lodsb                           ; get the character
  432.         mov     ah,9                    ; call to write cell
  433.         push    cx                      ; save registers
  434.         push    si
  435.         mov     cx,1                    ; write it once
  436.         int     10h                     ; do the interrupt
  437.         pop     si                      ; restore registers
  438.         pop     cx
  439.         loop    f16_100                 ; loop and do it again
  440.  
  441.         mov     ax,0                    ; successful return
  442.  
  443.         Exit_Vio 16,16                  ; get out
  444.  
  445. VioWrtCharStrAtt endp
  446.  
  447. VioWrtNAttr proc far
  448.  
  449.         Enter_Vio
  450.  
  451.         Check_Handle 17
  452.  
  453.         Do_Row_Col 17,10,8
  454.  
  455.         mov     ax,0b800h               ; offset for color card
  456.         mov     es,ax                   ; es:di is now set up
  457.  
  458.         mov     cx,[bp+12]              ; get length
  459.         lds     si,[bp+14]              ; get the pointer in ds:si
  460.         lodsb                           ; get the character attribute
  461.  
  462. f17_100:
  463.         inc     di                      ; get past character byte
  464.         stosb                           ; save the attribute
  465.         loop    f17_100                 ; loop for next one
  466.  
  467.         mov     ax,0                    ; successful return
  468.  
  469.         Exit_Vio 17,12                  ; get out
  470.  
  471. VioWrtNAttr endp
  472.  
  473. VioWrtNCell proc far
  474.  
  475.         Enter_Vio
  476.  
  477.         Check_Handle 18
  478.  
  479.         Do_Row_Col 18,10,8
  480.  
  481.         mov     cx,[bp+12]              ; get length
  482.         shr     cx,1                    ; divide by two (two byte cells)
  483.         lds     si,[bp+14]              ; get the pointer in ds:si
  484.         mov     bh,0                    ; display page
  485.  
  486.         Locate_Cursor 18
  487.  
  488.         lodsw                           ; get the character cell in ax
  489.         mov     bl,ah                   ; put the attribute into bh
  490.         mov     ah,9                    ; call to write cell
  491.         int     10h                     ; do the interrupt
  492.  
  493.         mov     ax,0                    ; successful return
  494.  
  495.         Exit_Vio 18,12                  ; get out
  496.  
  497. VioWrtNCell endp
  498.  
  499. VioWrtNChar proc far
  500.  
  501.         Enter_Vio
  502.  
  503.         Check_Handle 19
  504.  
  505.         Do_Row_Col 19,10,8
  506.  
  507.         mov     cx,[bp+12]              ; get length
  508.         lds     si,[bp+14]              ; get the pointer in ds:si
  509.         mov     bh,0                    ; display page
  510.  
  511.         Locate_Cursor 19
  512.  
  513.         lodsb                           ; get the character cell in Al
  514.         mov     ah,10                   ; call to write cell
  515.         int     10h                     ; do the interrupt
  516.  
  517.         mov     ax,0                    ; successful return
  518.  
  519.         Exit_Vio 19,12                  ; get out
  520.  
  521. VioWrtNChar endp
  522.  
  523.  
  524.